package com.example.rabbitmqstudy.publish;

import com.example.rabbitmqstudy.utils.RabbitMQUtils;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Send {

    public static void main(String[] args) throws IOException, TimeoutException {
        Connection connection = RabbitMQUtils.getConnection();
        Channel channel = connection.createChannel();
        channel.exchangeDeclare(Data.EXCHANGE_NAME, "fanout");
        String message = "注册成功";
        channel.basicPublish(Data.EXCHANGE_NAME, "", null, message.getBytes());
        channel.close();
        connection.close();
    }
}
